package com.itheima.otherextends;

/*
    分析: 从子到父.   子类: 项目经理类Manager, 程序员类Coder
                      父类: 员工类: Worker【属性：姓名 工号 工资】【行为：工作work】
    编码: 从父到子
 */
//父类: 员工类
public class Worker {
    //【属性：姓名 工号 工资】
    private String name;
    private String id;
    private double salary;

    //【行为：工作work】
    public void work(){
        System.out.println("员工都要干活");
    }

    public Worker() {
    }

    public Worker(String name, String id, double salary) {
        this.name = name;
        this.id = id;
        this.salary = salary;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }
}

//子类: 程序员类
class Coder extends Worker{

    public Coder() {
    }

    public Coder(String name, String id, double salary) {
        super(name, id, salary);
    }

    @Override
    public void work() {
        System.out.println(" 姓名为:"+super.getName()+",工号为:"+super.getId()+",工资为:"+super.getSalary()+",的程序员正在编写代码");
    }
}

class Manager extends Worker{
    private double money;


    public double getMoney() {
        return money;
    }


    public Manager() {

    }

    public Manager(String name, String id, double salary, double money) {
        super(name, id, salary);
        this.money = money;
    }

    @Override
    public void work() {
        System.out.println(" 姓名为:"+super.getName()+",工号为:"+super.getId()+",工资为:"+super.getSalary()+"奖金为"+this.money+"的项目经理正在管理程序员写代码");
    }
}